package com.guigu.controller;


import com.guigu.entity.Indicator;
import com.guigu.service.IndicatorService;
import com.guigu.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/HealthPlan")
public class IndicatorController {

    @Autowired
    private IndicatorService indicatorService;

    @PostMapping("/queryIndicatorByName")
    @ResponseBody
    public Result queryIndicatorByName(String name){
        return new Result("200","true","成功查询",this.indicatorService.queryIndicatorByName(name));
    }

    @PostMapping("/addIndicator")
    public Result addIndicator(@RequestBody Indicator indicator){
        this.indicatorService.addIndicator(indicator);
        return new Result("200","true","成功添加", null);
    }

    @PostMapping("/updateIndicator")
    public Result updateIndicator(@RequestBody Indicator indicator){
        this.indicatorService.updateIndicator(indicator);
        return new Result("200","true","成功修改", null);
    }
    @PostMapping("/queryIndicatorById")
    public Result queryIndicatorById(@RequestBody Indicator indicator){
        return new Result("200","true","成功查询",this.indicatorService.queryIndicatorById(indicator));
    }
}
